﻿<%@ Page Language="C#" MasterPageFile="~/Manage/MainPage.master"  AutoEventWireup="true" CodeFile="CategoriesManage.aspx.cs" Inherits="Manage_CategoriesManage" %>
<%@ Import Namespace="Shopping.Common" %>
<%@ Import Namespace="Shopping.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<script type="text/javascript" src="/Manage/Js/CategoriesManage.js"></script>
<script type="text/javascript">
    ModelOfCategory = <% = new Categories().ToJsonString() %>;
    SelectOptionOfCategory ='<%=SelectOptionOfCategory %>';
</script>

 
<table width="99%" border="0" cellspacing="0" cellpadding="0" class="table" align="center">
  <tr>
    <td colspan="4" align="left" class="HeadTitle">&gt;&gt;类别管理</td>
  </tr>
  <tr class="TableHeadRow">
    <td width="60" align="center">序号</td>
    <td align="left">类别名称 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<a onclick="return GetForm(0,0);" href="javascript:void(0);" class="red">+添加类别</a>]</td>
    <td width="100" align="center">状态</td>
    <td width="150" align="center">创建日期</td>
    </tr>

    <%
        if (listOfCategory != null)
        {
            for (int i = 0; i < listOfCategory.Count; ++i)
            {
                Categories c = listOfCategory[i];
                string styles = "";
                if (c.Status != Status.正用.ToString())
                    styles = "color:gray;";
               
     %>
  <tr id="tr<%=c.CategoryID %>" onmouseover="this.style.backgroundColor='#F2F2F2';SwitchAct(<%=c.CategoryID %>);" onmouseout="this.style.backgroundColor='#FFFFFF';SwitchAct(<%=c.CategoryID %>);" bgcolor="#FFFFFF" >
    <td align="center"><%=i+1 %>.</td>
    <td align="left">
     <%
         for (int j = 1; j < listOfCategory[i].Depth; ++j)
        {
            Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        }
     %>
    <a href="javascript:void(0);" onclick="return GetForm(<%=c.ParentID %>,<%=c.CategoryID %>);" style="<%=styles%>" >
    <%=c.CategoryName %> (ID=<%=c.CategoryID %>)</a>

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span id="spAct<%=c.CategoryID%>" style="display:none; text-align:right;" align="right">
 
 [<a href="javascript:void(0);" onclick="return GetForm(<%=c.ParentID %>,<%=c.CategoryID %>);" >编辑类别</a>] 
 [<a href="javascript:void(0);" onclick="return GetForm(<%=c.CategoryID %>,0);" >增加子类别</a>]  
    <%
        if (c.Status == Status.正用.ToString())
        {
         %>
         [ <a href="javascript:void(0);" onclick="javascript:ModifyStatus(<%=c.CategoryID %>,'停用');" class="red">停用</a> ]
         <%
        }
        else
        { %>
          [ <a href="javascript:void(0);" onclick="javascript:ModifyStatus(<%=c.CategoryID %>,'正用');" class="green">启用</a> ]
       <%} %>

       [ <a href="javascript:void(0);" onclick="javascript:Delete(<%=c.CategoryID %>);" class="red">删除该类别</a> ]
	</span>    </td>
    <td align="center"><%=c.Status %></td>
    <td align="center"><%=c.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") %></td>
    </tr>
   <% }
        }
        else
        { %>
  
  <tr>
    <td colspan="4" align="center">[ <span class="red bold">系统未找到任何分类信息!</span> ]</td>
    </tr>
    <%} %>
</table>
<br />
<br />
</asp:Content>
